package com.atguigu.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * @author ：jjt8024
 * @date ：Created in 2021/3/11 22:04
 */
@Component
@EnableBinding(Sink.class)
public class RecieverController {


    @Value("${server.port}")
    private String port;

    @StreamListener(Sink.INPUT)
    public  void get(Message<String> message){
        System.out.println(port+"消费者 获取到的消息："+ message.getPayload().toString());
    }

}
